home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gxfont42.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  3.7 KB  |  95 lines

  1. /* Copyright (C) 1996, 2000 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gxfont42.h,v 1.4 2000/09/19 19:00:37 lpd Exp $ */
  20. /* Type 42 font data definition */
  21.  
  22. #ifndef gxfont42_INCLUDED
  23. #  define gxfont42_INCLUDED
  24.  
  25. /* This is the type-specific information for a Type 42 (TrueType) font. */
  26. typedef struct gs_type42_data_s gs_type42_data;
  27. #ifndef gs_font_type42_DEFINED
  28. #  define gs_font_type42_DEFINED
  29. typedef struct gs_font_type42_s gs_font_type42;
  30. #endif
  31. typedef struct gs_type42_mtx_s {
  32.     uint numMetrics;        /* num*Metrics from [hv]hea */
  33.     ulong offset;        /* offset to [hv]mtx table */
  34.     uint length;        /* length of [hv]mtx table */
  35. } gs_type42_mtx_t;
  36. struct gs_type42_data_s {
  37.     /* The following are set by the client. */
  38.     int (*string_proc) (P4(gs_font_type42 *, ulong, uint, const byte **));
  39.     void *proc_data;        /* data for procedures */
  40.     /*
  41.      * The following are initialized by ...font_init, but may be reset by
  42.      * the client.  get_outline returns 1 if the string is newly allocated
  43.      * (using the font's allocator) and can be freed by the client.
  44.      */
  45.     int (*get_outline)(P3(gs_font_type42 *pfont, uint glyph_index,
  46.               gs_const_string *pgstr));
  47.     int (*get_metrics)(P4(gs_font_type42 *pfont, uint glyph_index, int wmode,
  48.               float sbw[4]));
  49.     /* The following are cached values. */
  50.     ulong glyf;            /* offset to glyf table */
  51.     uint unitsPerEm;        /* from head */
  52.     uint indexToLocFormat;    /* from head */
  53.     gs_type42_mtx_t metrics[2];    /* hhea/hmtx, vhea/vmtx (indexed by WMode) */
  54.     ulong loca;            /* offset to loca table */
  55.     uint numGlyphs;        /* from size of loca */
  56. };
  57. #define gs_font_type42_common\
  58.     gs_font_base_common;\
  59.     gs_type42_data data
  60. struct gs_font_type42_s {
  61.     gs_font_type42_common;
  62. };
  63.  
  64. extern_st(st_gs_font_type42);
  65. #define public_st_gs_font_type42()    /* in gstype42.c */\
  66.   gs_public_st_suffix_add1_final(st_gs_font_type42, gs_font_type42,\
  67.     "gs_font_type42", font_type42_enum_ptrs, font_type42_reloc_ptrs,\
  68.     gs_font_finalize, st_gs_font_base, data.proc_data)
  69.  
  70. /*
  71.  * Because a Type 42 font contains so many cached values,
  72.  * we provide a procedure to initialize them from the font data.
  73.  * Note that this initializes get_outline and the font procedures as well.
  74.  */
  75. int gs_type42_font_init(P1(gs_font_type42 *));
  76.  
  77. /* Append the outline of a TrueType character to a path. */
  78. int gs_type42_append(P7(uint glyph_index, gs_imager_state * pis,
  79.             gx_path * ppath, const gs_log2_scale_point * pscale,
  80.             bool charpath_flag, int paint_type,
  81.             gs_font_type42 * pfont));
  82.  
  83. /* Get the metrics of a TrueType character. */
  84. int gs_type42_get_metrics(P3(gs_font_type42 * pfont, uint glyph_index,
  85.                  float psbw[4]));
  86. int gs_type42_wmode_metrics(P4(gs_font_type42 * pfont, uint glyph_index,
  87.                    int wmode, float psbw[4]));
  88.  
  89. /* Export the font procedures so they can be called from the interpreter. */
  90. font_proc_enumerate_glyph(gs_type42_enumerate_glyph);
  91. font_proc_glyph_info(gs_type42_glyph_info);
  92. font_proc_glyph_outline(gs_type42_glyph_outline);
  93.  
  94. #endif /* gxfont42_INCLUDED */
  95.